package com.gxa.admin.controller;


import com.gxa.common.vo.JsonResult;
import com.gxa.common.vo.PageRecv;
import com.gxa.common.vo.ResultVo;
import com.gxa.modules.pojo.LoanSearch;
import com.gxa.modules.pojo.Loanafter_Payback;
import com.gxa.modules.pojo.Loanafter_Warning;
import com.gxa.modules.service.Loanafter_PayBackService;
import com.gxa.modules.service.Loanafter_WarningService;
import io.swagger.annotations.*;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "数据test",tags = "贷后管理——贷后预警——张剑宇")
@RestController


@RequestMapping("/loanafter")
public class Loanafter_PayBackController {

    @Autowired(required = false)
    private Loanafter_PayBackService loanafter_payBackService;


    //1.查询提前还款信息
    @PostMapping("/loanafter_payback/earlyquery")
   //@RequiresPermissions("/home/afterloan/prepaymentcheck")
    @ApiOperation(value = "增加还款信息",notes = "还款信息实体",httpMethod = "POST", response = ResultVo.class)

    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=400,message="坏请求"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=405,message="Method请求错误"),
            @ApiResponse(code=500,message="后台服务错误")
    })

    public ResultVo add(@RequestBody @ApiParam(name = "loanafter_checkreport",value = "贷后检查报告实体",required = true) LoanSearch loanSearch){

        ResultVo r=loanafter_payBackService.queryEarlyPayBack(loanSearch);
        return r;
    }
    //2.查询详细还款信息
        @PostMapping("/loanafter_payback/query")
       //@RequiresPermissions("/home/afterloan/check")
        @ApiOperation(value = "查询还款信息",notes = "贷后还款信息实体",httpMethod = "POST", response = ResultVo.class)

        @ApiResponses({
                @ApiResponse(code=200,message="请求成功"),
                @ApiResponse(code=400,message="坏请求"),
                @ApiResponse(code=404,message="找不到页面"),
                @ApiResponse(code=405,message="Method请求错误"),
                @ApiResponse(code=500,message="后台服务错误")
        })

        public JsonResult query(@RequestBody @ApiParam(name = "pageRecv",value = "贷后预警报告实体",required = true) PageRecv<LoanSearch> pageRecv){

            JsonResult r=loanafter_payBackService.queryPayBack(pageRecv);
            return r;
        }
    //2.查询借据还款信息
    @PostMapping("/loanafter_payback/queryLoan")
    @ApiOperation(value = "查询还款信息",notes = "贷后还款信息实体",httpMethod = "POST", response = ResultVo.class)

    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=400,message="坏请求"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=405,message="Method请求错误"),
            @ApiResponse(code=500,message="后台服务错误")
    })

    public JsonResult queryLoan(@RequestBody @ApiParam(name = "pageRecv",value = "贷后预警报告实体",required = true) PageRecv<LoanSearch> pageRecv){

        JsonResult r=loanafter_payBackService.queryPayBackLoan(pageRecv);
        return r;
    }

    //3.修改还款信息
    @PostMapping("/loanafter_payback/update")
    @ApiOperation(value = "修改还款信息",notes = "还款信息实体",httpMethod = "POST", response = ResultVo.class)

    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=400,message="坏请求"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=405,message="Method请求错误"),
            @ApiResponse(code=500,message="后台服务错误")
    })

    public ResultVo update(@RequestBody @ApiParam(name = "loanafter_warning",value = "贷后预警报告实体",required = true) Loanafter_Payback loanafter_payback){

        ResultVo r=loanafter_payBackService.updatePayBack(loanafter_payback);
        return r;
    }
    //3.修改还款信息
   //@RequiresPermissions("/home/afterloan/ratecheck")
    @PostMapping("/loanafter_payback/updateearlypayback")
    @ApiOperation(value = "修改还款信息",notes = "还款信息实体",httpMethod = "POST", response = ResultVo.class)

    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=400,message="坏请求"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=405,message="Method请求错误"),
            @ApiResponse(code=500,message="后台服务错误")
    })

    public ResultVo updateearlypayback(@RequestBody @ApiParam(name = "loanafter_payback",value = "贷后预警报告实体",required = true) LoanSearch loanSearch){

        ResultVo r=loanafter_payBackService.updateEarlyPayBack(loanSearch);
        return r;
    }
}
